function ajax(method, url, fn) {
    var xhr = new XMLHttpRequest();
    xhr.open(method, url);
    xhr.onload = function () {
        var result = JSON.parse(xhr.responseText);

        fn(result)
    }
    xhr.send();
}